package com.baihui.taobao.vo;

import com.taobao.api.domain.Location;
import com.taobao.api.domain.User;
import com.taobao.api.domain.UserCredit;
import com.taobao.api.internal.mapping.ApiField;

/**
 * Created by Kevin.
 * User: HSZM1106-0312
 * Date: 12-1-15
 * Time: 上午9:26
 * 将原来淘宝返回的User中的location,buyerCredit, sellerCredit对应的信息全部放入到User表中，不用建立新的表。
 * 在导入数据的时候给这些值赋值. 同时在UserDAO中将 location,buyerCredit, sellerCredit 添加在excludes数组中.
 */
public class BUser extends User {
    public static final String DEAL = "DEAL"; //已经成交用户,从订单中获取的用户
    public static final String UNDEAL = "UNDEAL"; //未成交买家，从旺旺获取的用户

    private int exported = 0;  //标示是否已经导出
    private String baihuiid;
    
    private Long sellerid;
    private int lotNo;

    //用户类型，成交或者未成交
    private String userType;

    /**以下为用户Location中的信息，直接存放到用户表中，不用新建立表了。**/

    /**
     * 详细地址，最大256个字节（128个中文）
     */
    @ApiField("address")
    private String address;

    /**
     * 所在城市（中文名称）
     */
    @ApiField("city")
    private String city;

    /**
     * 国家名称
     */
    @ApiField("country")
    private String country;

    /**
     * 区/县（只适用于物流API）
     */
    @ApiField("district")
    private String district;

    /**
     * 所在省份（中文名称）
     */
    @ApiField("state")
    private String state;

    /**
     * 邮政编码
     */
    @ApiField("zip")
    private String zip;

    /**以下为用户卖家信用sellerCredit中的信息，直接存放到用户表中，不用新建立表了。**/

    /**
     * 收到的好评总条数。取值范围:大于零的整数
     */
    @ApiField("sellerCredit_goodNum")
    private Long sellerCredit_goodNum;

    /**
     * 信用等级（是根据score生成的），信用等级：淘宝会员在淘宝网上的信用度，分为20个级别，级别如：level = 1 时，表示一心；level = 2 时，表示二心
     */
    @ApiField("sellerCredit_level")
    private Long sellerCredit_level;

    /**
     * 信用总分（“好评”加一分，“中评”不加分，“差评”扣一分。分越高，等级越高）
     */
    @ApiField("sellerCredit_score")
    private Long sellerCredit_score;

    /**
     * 收到的评价总条数。取值范围:大于零的整数
     */
    @ApiField("sellerCredit_totalNum")
    private Long sellerCredit_totalNum;


    /**以下为用户卖家信用buyerCredit中的信息，直接存放到用户表中，不用新建立表了。**/
    /**
     * 收到的好评总条数。取值范围:大于零的整数
     */
    @ApiField("buyerCredit_goodNum")
    private Long buyerCredit_goodNum;

    /**
     * 信用等级（是根据score生成的），信用等级：淘宝会员在淘宝网上的信用度，分为20个级别，级别如：level = 1 时，表示一心；level = 2 时，表示二心
     */
    @ApiField("buyerCredit_level")
    private Long buyerCredit_level;

    /**
     * 信用总分（“好评”加一分，“中评”不加分，“差评”扣一分。分越高，等级越高）
     */
    @ApiField("buyerCredit_score")
    private Long buyerCredit_score;

    /**
     * 收到的评价总条数。取值范围:大于零的整数
     */
    @ApiField("buyerCredit_totalNum")
    private Long buyerCredit_totalNum;

    public int getExported() {
        return exported;
    }

    public Long getSellerid() {
        return sellerid;
    }

    public void setSellerid(Long sellerid) {
        this.sellerid = sellerid;
    }

    public String getBaihuiid() {
        return baihuiid;
    }

    public void setBaihuiid(String baihuiid) {
        this.baihuiid = baihuiid;
    }

    public void setExported(int exported) {
        this.exported = exported;
    }

    public Long getSellerCredit_goodNum() {
        return sellerCredit_goodNum;
    }

    public void setSellerCredit_goodNum(Long sellerCredit_goodNum) {
        this.sellerCredit_goodNum = sellerCredit_goodNum;
    }

    public int getLotNo() {
        return lotNo;
    }

    public void setLotNo(int lotNo) {
        this.lotNo = lotNo;
    }

    public Long getSellerCredit_level() {
        return sellerCredit_level;
    }

    public void setSellerCredit_level(Long sellerCredit_level) {
        this.sellerCredit_level = sellerCredit_level;
    }

    public Long getSellerCredit_score() {
        return sellerCredit_score;
    }

    public void setSellerCredit_score(Long sellerCredit_score) {
        this.sellerCredit_score = sellerCredit_score;
    }

    public Long getSellerCredit_totalNum() {
        return sellerCredit_totalNum;
    }

    public void setSellerCredit_totalNum(Long sellerCredit_totalNum) {
        this.sellerCredit_totalNum = sellerCredit_totalNum;
    }

    public Long getBuyerCredit_goodNum() {
        return buyerCredit_goodNum;
    }

    public void setBuyerCredit_goodNum(Long buyerCredit_goodNum) {
        this.buyerCredit_goodNum = buyerCredit_goodNum;
    }

    public Long getBuyerCredit_level() {
        return buyerCredit_level;
    }

    public void setBuyerCredit_level(Long buyerCredit_level) {
        this.buyerCredit_level = buyerCredit_level;
    }

    public Long getBuyerCredit_score() {
        return buyerCredit_score;
    }

    public void setBuyerCredit_score(Long buyerCredit_score) {
        this.buyerCredit_score = buyerCredit_score;
    }

    public Long getBuyerCredit_totalNum() {
        return buyerCredit_totalNum;
    }

    public void setBuyerCredit_totalNum(Long buyerCredit_totalNum) {
        this.buyerCredit_totalNum = buyerCredit_totalNum;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getZip() {
        return zip;
    }

    public void setZip(String zip) {
        this.zip = zip;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    @Override
    public void setLocation(Location location) {
        super.setLocation(location);
        this.address = location.getAddress();
        this.city = location.getCity();
        this.country = location.getCountry();
        this.state = location.getState();
        this.district = location.getDistrict();
    }

    @Override
    public void setBuyerCredit(UserCredit buyerCredit) {
        super.setBuyerCredit(buyerCredit);
        this.buyerCredit_goodNum = buyerCredit.getGoodNum();
        this.buyerCredit_level  =buyerCredit.getLevel();
        this.buyerCredit_score = buyerCredit.getScore();
        this.buyerCredit_totalNum = buyerCredit.getTotalNum();
    }

    @Override
    public void setSellerCredit(UserCredit sellerCredit) {
        super.setSellerCredit(sellerCredit);
        this.sellerCredit_goodNum = sellerCredit.getGoodNum();
        this.sellerCredit_level = sellerCredit.getLevel();
        this.sellerCredit_score = sellerCredit.getScore();
        this.sellerCredit_totalNum = sellerCredit.getTotalNum();
    }
}
